﻿using System;

namespace ExFlash.Tags
{
    public class VideoFrameTag : Tag
    {
        public ushort StreamId
        {
            get;
            protected set;
        }

        public ushort FrameNum
        {
            get;
            protected set;
        }

        public Byte[] VideoData
        {
            get;
            protected set;
        }

        public VideoFrameTag(int len, int offset)
            : base(TagCodes.VideoFrame, len, offset)
        {

        }

        public override void SwfDeserialize(BinaryBitReader reader)
        {
            long startIndex = reader.Position;
            
            StreamId = reader.ReadUInt16();

            FrameNum = reader.ReadUInt16();

            int videoLen = TagLength - (int)(reader.Position - startIndex);
            VideoData = new Byte[videoLen];
            reader.Read(VideoData, 0, videoLen);
        }

        public override void SwfSerialize(byte[] arr, ref int offset)
        {
            throw new NotImplementedException();
        }
    }
}
